package com.whmskj.xjlhsc.mobie.Scheduling.controller;

import com.whmskj.xjlhbc.core.AjaxResult;
import com.whmskj.xjlhbc.core.Page;
import com.whmskj.xjlhsc.controller.vo.Result;
import com.whmskj.xjlhsc.jitapi.entity.Device;
import com.whmskj.xjlhsc.mobie.Scheduling.Dto.DeviceQueryDTO;
import com.whmskj.xjlhsc.mobie.Scheduling.Dto.EmployeeFilesDTO;
import com.whmskj.xjlhsc.mobie.Scheduling.Dto.EmployeeFilesResultDTO;
import com.whmskj.xjlhsc.mobie.Scheduling.Dto.EmployeeStatisticsDTO;
import com.whmskj.xjlhsc.mobie.Scheduling.Service.EmployeeFilesService;
import com.whmskj.xjlhsc.mobie.Scheduling.entity.yg01EmployeeFiles;
import com.whmskj.xjlhsc.mobie.empProPlan.entity.ProPersonnelStandConfirm;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @Author: Sakura
 * @Date: 2025/8/26 15:45
 * @Version: v1.0.0
 * @Description: TODO
 **/
// 排班总览
@RestController
@RequestMapping("/api/scheduling")
@Tag(description = "排班总览接口", name = "排班总览接口")
public class Scheduling01Controller {

    @Autowired
    private EmployeeFilesService employeeFilesService;

    // 获取员工男女数量
    @GetMapping("/statistics")
    public AjaxResult getStatistics() {
        EmployeeStatisticsDTO statistics = employeeFilesService.getEmployeeStatistics();
        return AjaxResult.success(statistics);
    }

    // 分页查询员工档案
    @GetMapping("/list")
    public AjaxResult list(EmployeeFilesDTO employeeFiles) {
        EmployeeFilesResultDTO result = employeeFilesService.selectEmployeeFilesList(employeeFiles);
        return AjaxResult.success(result);
    }

    // 获取排班总览
    @GetMapping("/pbzl")
    public AjaxResult getOverview(@RequestBody ProPersonnelStandConfirm  params) {
        Map<String, Object> result = employeeFilesService.getScheduleOverview(params);
        return AjaxResult.success(result);
    }

    // 根据机台查询人员信息
    @PostMapping("/queryPersonnel")
    @ApiOperation("根据机台查询人员信息")
    public AjaxResult queryPersonnelByDevice(@RequestBody DeviceQueryDTO queryDTO) {
        List<ProPersonnelStandConfirm> result = employeeFilesService.queryPersonnelByDevice(queryDTO);
            return AjaxResult.success(result);
    }

    // 机台下拉框
    @GetMapping("/deviceList")
    public AjaxResult getDeviceList(@RequestBody Device params) {
        Map<String, List<Device>> deviceList = employeeFilesService.getDeviceList(params);
        return AjaxResult.success(deviceList);
    }
}
